package com.jic.interaction.JDVOP.controller;

import com.jic.interaction.JDVOP.common.utils.RestResult;
import com.jic.interaction.JDVOP.model.vo.request.DeletePushMessageRequest;
import com.jic.interaction.JDVOP.model.vo.request.SelectPushMessageRequest;
import com.jic.interaction.JDVOP.model.vo.response.DeletePushMessageResponse;
import com.jic.interaction.JDVOP.model.vo.response.SelectPushMessageResponse;
import com.jic.interaction.JDVOP.service.PushMessageService;
import com.jic.interaction.weCashier.model.vo.request.SelectPreOrderRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException;
import java.util.List;

@RestController
@Slf4j
@RequestMapping("/api/message")
@Api(tags = " [推送信息]")
public class PushMessageController {

    @Resource
    PushMessageService pushMessageService;
    /**
     * 查询推送信息
     * @return
     */
    @PostMapping("/get")
    @ApiOperation(value = "查询推送信息")
    public RestResult<List<SelectPushMessageResponse>> selectPushMessage(@RequestBody SelectPushMessageRequest selectPreOrderRequest) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
        return pushMessageService.getPushMessage(selectPreOrderRequest) ;
    }

    @PostMapping("/del")
    @ApiOperation(value = "删除推送信息")
    public RestResult<DeletePushMessageResponse> deletePushMessage(@RequestBody DeletePushMessageRequest deletePushMessageRequest) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        return pushMessageService.delPushMessage(deletePushMessageRequest) ;
    }


}
